{% set pypi_name = 'debtcollector' %}
{% set upstream_version = upstream_version('2.2.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        A collection of Python deprecation patterns and strategies
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/debtcollector/latest/
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('fixtures') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('python-subunit') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('wrapt') }}
BuildArch:      noarch

%description
A collection of Python deprecation patterns and strategies that help
you collect your technical debt in a non-destructive manner. The goal
of this library is to provide well documented developer facing
deprecation patterns that start of with a basic set and can expand
into a larger set of patterns as time goes on. The desired output of
these patterns is to apply the warnings module to emit
DeprecationWarning or PendingDeprecationWarning or similar derivative
to developers using libraries (or potentially applications) about
future deprecations.

%package -n {{ py2name(py_versions='py3') }}
Summary:        A collection of Python deprecation patterns and strategies
Requires:       {{ py3('pbr') }}
Requires:       {{ py3('six') }}
Requires:       {{ py3('wrapt') }}

%description -n {{ py2name(py_versions='py3') }}
A collection of Python deprecation patterns and strategies that help
you collect your technical debt in a non-destructive manner. The goal
of this library is to provide well documented developer facing
deprecation patterns that start of with a basic set and can expand
into a larger set of patterns as time goes on. The desired output of
these patterns is to apply the warnings module to emit
DeprecationWarning or PendingDeprecationWarning or similar derivative
to developers using libraries (or potentially applications) about
future deprecations.

This package contains the Python 3.x module.

%package -n python-debtcollector-doc
Summary:        Documentation for %{name}
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}

%description -n python-debtcollector-doc
A collection of Python deprecation patterns and strategies that help
you collect your technical debt in a non-destructive manner. The goal
of this library is to provide well documented developer facing
deprecation patterns that start of with a basic set and can expand
into a larger set of patterns as time goes on. The desired output of
these patterns is to apply the warnings module to emit
DeprecationWarning or PendingDeprecationWarning or similar derivative
to developers using libraries (or potentially applications) about
future deprecations.

This package contains documentation in HTML format.

%prep
%autosetup -p1 -n {{pypi_name}}-{{ upstream_version }}
%py_req_cleanup

%build
%py3_build

# generate html doc
PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
# remove the Sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%check
python3 -m stestr.cli run

%install
%py3_install

%files -n {{ py2name(py_versions='py3') }}
%license LICENSE
%doc README.rst
%{python3_sitelib}/{{ pypi_name }}
%{python3_sitelib}/{{ pypi_name }}-*.egg-info

%files -n python-debtcollector-doc
%license LICENSE
%doc doc/build/html

%changelog
